package chapter17;

import chapter17.pojo.Role;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-04-20 下午5:31
 */
public class TestDemo {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
        RedisTemplate template = ctx.getBean(RedisTemplate.class);
        Role role = new Role();
        role.setId(1L);
        role.setRoleName("role_name_1");
        role.setNote("role_note");
        template.opsForValue().set("role_1", role);
        Role role1 = (Role) template.opsForValue().get("role_1");
        System.out.println(role1.toString());
    }
}
